import { reactive } from 'vue'
import { VxeGridProps } from 'vxe-table'

interface Rows {
  patentNo: string
  patentName: string
  patentType: string
  date: string
  patentPeople: string
  patentUnit: string
  submitDate: string
}

const patentOptions = reactive<VxeGridProps<Rows>>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  columns: [
    { title: '序号', type: 'seq', width: 50 },
    { field: 'patentCode', title: '专利号' },
    { field: 'patentName', title: '专利名称' },
    { field: 'applyDate', title: '申请日期' },
    { field: 'owner', title: '专利权人' },
    { field: 'completeUnit', title: '完成单位' },
    { field: 'createTime', title: '提交日期' ,formatter: ['formatDate', 'yyyy-MM-dd HH:mm:ss']},
    { title: '操作', width: 300, slots: { default: 'operate' } },
  ],
  data: [],
})

const patentDescriptions = reactive([
  {
    label: '专利号：',
    value: 'patentCode',
  },
  {
    label: '专利名称：',
    value: 'patentName',
  },
  {
    label: '申请日期：',
    value: 'applyDate',
  },
  {
    label: '授权日期：',
    value: 'authDate',
  },
  {
    label: '专利权人：',
    value: 'owner',
  },
  {
    label: '完成单位：',
    value: 'completeUnit',
  },
])

const patentPeople = reactive<VxeGridProps<Rows>>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  editConfig: {
    // trigger: 'manual',
    // mode: 'row',
    // showStatus: true,
  },
  columns: [
    { title: '序号', type: 'seq', width: 50 },
    {
      field: 'name',
      title: '姓名',
    },
    {
      field: 'mobile',
      title: '手机号',
    },
    {
      field: 'employeeCode',
      title: '员工编号',
    },
    {
      field: 'contributeProportion',
      title: '贡献率',
    },
    // { title: '操作', width: 300, slots: { default: 'operate' } },
  ],
  toolbarConfig: {},
  data: [],
})

const operationLog = reactive<VxeGridProps>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  columns: [
    { field: 'type', title: '操作类型', width: 200 },
    { field: 'name', title: '操作员', width: 200 },
    { field: 'content', title: '操作内容' },
    { field: 'date', title: '操作时间', width: 200 },
  ],
  toolbarConfig: {
    slots: {
      buttons: 'toolbar_buttons',
    },
  },
  data: [
    {
      type: '修改状态',
      name: 'xxx',
      content: 'xxxxxxxxxxxxxxxxxxxx',
      date: '2023-01-01 00:00:00',
    },
  ],
})

export { patentOptions, patentDescriptions, patentPeople, operationLog }
